﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="GeneratedArtifact.cs" company="Sander van Vliet">
//   2011 Sander van Vliet
// </copyright>
// <summary>
//   The generated artifact.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace TFDP.Common
{
    using System.Collections.Generic;

    using Microsoft.Data.Schema.SchemaModel;
    using Microsoft.VisualStudio.Shell.Interop;

    /// <summary>
    /// The generated artifact.
    /// </summary>
    public sealed class GeneratedArtifact
    {
        #region Constants and Fields

        /// <summary>
        /// The model element.
        /// </summary>
        private IModelElement modelElement;

        /// <summary>
        /// The project hierarchy.
        /// </summary>
        private IVsProject projectHierarchy;

        /// <summary>
        /// The project name.
        /// </summary>
        private string projectName;

        /// <summary>
        /// The properties.
        /// </summary>
        private Dictionary<string, string> properties;

        /// <summary>
        /// The target file name.
        /// </summary>
        private string targetFileName;

        /// <summary>
        /// The temporary file name.
        /// </summary>
        private string temporaryFileName;

        #endregion

        #region Constructors and Destructors

        /// <summary>
        /// Initializes a new instance of the <see cref="GeneratedArtifact"/> class.
        /// </summary>
        /// <param name="temporaryFileName">
        /// The temporary file name.
        /// </param>
        /// <param name="targetFileName">
        /// The target file name.
        /// </param>
        public GeneratedArtifact(string temporaryFileName, string targetFileName)
            : this(temporaryFileName, targetFileName, null, null, null)
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="GeneratedArtifact"/> class.
        /// </summary>
        /// <param name="temporaryFileName">
        /// The temporary file name.
        /// </param>
        /// <param name="targetFileName">
        /// The target file name.
        /// </param>
        /// <param name="modelElement">
        /// The model element.
        /// </param>
        public GeneratedArtifact(string temporaryFileName, string targetFileName, IModelElement modelElement)
            : this(temporaryFileName, targetFileName, null, modelElement, null)
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="GeneratedArtifact"/> class.
        /// </summary>
        /// <param name="temporaryFileName">
        /// The temporary file name.
        /// </param>
        /// <param name="targetFileName">
        /// The target file name.
        /// </param>
        /// <param name="projectName">
        /// The project name.
        /// </param>
        /// <param name="modelElement">
        /// The model element.
        /// </param>
        public GeneratedArtifact(
            string temporaryFileName, string targetFileName, string projectName, IModelElement modelElement)
            : this(temporaryFileName, targetFileName, projectName, modelElement, null)
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="GeneratedArtifact"/> class.
        /// </summary>
        /// <param name="temporaryFileName">
        /// The temporary file name.
        /// </param>
        /// <param name="targetFileName">
        /// The target file name.
        /// </param>
        /// <param name="projectName">
        /// The project name.
        /// </param>
        /// <param name="modelElement">
        /// The model element.
        /// </param>
        /// <param name="properties">
        /// The properties.
        /// </param>
        public GeneratedArtifact(
            string temporaryFileName, 
            string targetFileName, 
            string projectName, 
            IModelElement modelElement, 
            Dictionary<string, string> properties)
        {
            this.temporaryFileName = temporaryFileName;
            this.targetFileName = targetFileName;
            this.modelElement = modelElement;
            this.projectName = projectName;
            this.properties = properties ?? new Dictionary<string, string>();
        }

        #endregion

        #region Public Properties

        /// <summary>
        /// Gets or sets ModelElement.
        /// </summary>
        public IModelElement ModelElement
        {
            get
            {
                return this.modelElement;
            }

            set
            {
                this.modelElement = value;
            }
        }

        /// <summary>
        /// Gets or sets ProjectHierarchy.
        /// </summary>
        public IVsProject ProjectHierarchy
        {
            get
            {
                return this.projectHierarchy;
            }

            set
            {
                this.projectHierarchy = value;
            }
        }

        /// <summary>
        /// Gets or sets ProjectName.
        /// </summary>
        public string ProjectName
        {
            get
            {
                return this.projectName;
            }

            set
            {
                this.projectName = value;
            }
        }

        /// <summary>
        /// Gets Properties.
        /// </summary>
        public Dictionary<string, string> Properties
        {
            get
            {
                return this.properties;
            }
        }

        /// <summary>
        /// Gets TargetFileName.
        /// </summary>
        public string TargetFileName
        {
            get
            {
                return this.targetFileName;
            }
        }

        /// <summary>
        /// Gets TemporaryFileName.
        /// </summary>
        public string TemporaryFileName
        {
            get
            {
                return this.temporaryFileName;
            }
        }

        #endregion
    }
}